import threading
import yaml
import json
import datetime
import pathlib
import time
import shutil
import subprocess
import os
import sys
import re
import requests
import psutil
import ctypes
import typing
import configparser
import zipfile
import sqlite3
import random
import logging
import cv2
import base64
import io
import PIL.Image
import uiautomation



from PySide6.QtWidgets import (QWidget, QMainWindow, QDialog, QFileDialog, QMessageBox, QPushButton, QListView, QListWidget,
                               QListWidgetItem, QLineEdit, QTextEdit, QLabel, QHeaderView, QInputDialog, QApplication, QProgressBar, QComboBox, QTableWidget, QTableWidgetItem, QTableView,
                               QHBoxLayout,QVBoxLayout,QLayout)

from PySide6.QtCore import (Qt, QCoreApplication, QObject, QMetaObject,
                            Signal, Slot,
                            QDateTime,
                            QThread, QThreadPool, QTimer,QRunnable,
                            QTemporaryFile, QTemporaryDir,
                            QJsonArray, QJsonDocument, QJsonParseError, QJsonValue,
                            QFile, QFileDevice, QIODevice, QIODeviceBase, QFileInfo,
                            QTextStream, QStringListModel, QModelIndex)



class Worker_Thread(QThread):
    thread_task_data = Signal(dict)
    def __init__(self, parent = None):
        super().__init__(parent)
        
    def run(self):
        pass
        
        
        # 线程任务完成，会自动发送信号的,无需手动发送,手动发送可能会导致发送两遍信号.
        # self.finished.emit()
    def __delattr__(self, name):
        print(f"提示 : 子任务子线程运行结束!正在销毁资源 {self}")
        return super().__delattr__(name)
    

class Custom_b1(QPushButton):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setText("自定义按钮")
        self.clicked.connect(lambda: self.slot_fun("自定义按钮"))
        
    @Slot(str)
    def slot_fun(self,text):
        print(f"我是槽函数,我是 {text}")

    # 设置员工属性
    def Set_Staff_Attribute(self,**kwargs):
        """设置员工对象的属性，用于后续任务执行
        """
        for key, value in kwargs.items():
            setattr(self, key, value)
        print(f"已设置属性: {kwargs.keys()}")





